package com.chance.cc.crawler.prod.command.trigger.domain.news.sohu;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import com.chance.cc.crawler.prod.command.job.domain.news.sohu.SoHuCommonScript;
import com.chance.cc.crawler.prod.command.job.domain.news.sohu.realtime.SoHuCarSeriesCrawlerScheduleJob;
import com.chance.cc.crawler.prod.command.job.domain.news.sohu.realtime.SoHuRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.news.sohu.trace.SoHuCommentTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.news.sohu.trace.SoHuTraceCrawlerSchedulerJob;

import static com.chance.cc.crawler.prod.command.trigger.CommonCrawlerSchedulerTrigger.metaServiceCommand_17;

/**
 * @author lt
 * @version 1.0
 * @date 2021-04-09 16:15:57
 * @email okprog@sina.com
 */
public class SoHuCommonCrawlerScheduleTrigger  {

    public static void main(String[] args) {
//        publishSoHuRealtimeScheduleTriggerInfo();
//        publishSoHuTraceScheduleTriggerInfo();
//        publishSoHuCommentTraceScheduleTriggerInfo();
        publishSoHuCarSeriesTraceScheduleTriggerInfo();
    }

    public static void publishSoHuRealtimeScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuRealtimeCrawlerSchedulerJob.crawlerScheduler();
        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0/10 * * * ?",
                "搜狐新闻实时采集任务，每十分钟采集一次");
    }

    public static void publishSoHuTraceScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuTraceCrawlerSchedulerJob.crawlerScheduler();
        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 30 0 * * ?",
                "搜狐新闻追溯7日评论采集任务，每天采集一次");
    }

    public static void publishSoHuCommentTraceScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuCommentTraceCrawlerSchedulerJob.crawlerScheduler();
        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 * * * ?",
                "搜狐新闻追溯当日评论采集任务，每小时采集一次");
    }


    public static void publishSoHuCarSeriesTraceScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuCarSeriesCrawlerScheduleJob.publishCrawlerScheduleJobInfo();
        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCarSeriesCrawlerScheduleJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 1 * ?",
                "搜狐车系每月1号采集一次");
    }
}
